package test;

/*
 * Author: JacksonCoder
 * FileName: demo2
 * Version: 1.0.0
 * Date: 2025/5/5
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class demo2 {

    public static void main(String[] args) {

        String str = "1,2,3,4,5";
        List<String> list = Arrays.asList(str.split(","));
        System.out.println(list);


        // java 8
        String strs = "apple,banana,orange";
        List<String> list1 = Arrays.stream(strs.split(","))
                .map(String::trim)
                .collect(Collectors.toList());
        System.out.println(list1);

        //

        String words = "hello";
        List<Character> list2 = new ArrayList<>();
        for(char c: words.toCharArray()){
            list2.add(c);
        }
        System.out.println(list2);


    }

}
